//
//  CircleView.m
//  YiChe
//
//  Created by 蒋杏飞 on 15/8/8.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "CircleView.h"

// 创建一个上面是圆形，下面是label的按钮

@interface CircleView ()
@property (nonatomic, retain) UIImageView *subImage;
@property (nonatomic, retain) UILabel *titleLabel;
@end


@implementation CircleView

- (void)dealloc
{
    [_subImage release];
    [_titleLabel release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initionalViews];
    }
    return self;
}

- (void)initionalViews
{
    
    self.subImage = [[UIImageView alloc] initWithFrame:CGRectMake(20, 10, 55, 55)];
    self.subImage.backgroundColor = [UIColor blueColor];
    [self addSubview:_subImage];
    [_subImage release];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, _subImage.frame.size.height + _subImage.frame.origin.y + 5, 80, 20)];
    [self addSubview:_titleLabel];
    [_titleLabel release];
}

- (void)setImage:(NSString *)name text:(NSString *)title
{

#warning 等着，网络图片过来，然后赋值
    
    
    [self.subImage setImage:[UIImage imageNamed:name]];
    self.titleLabel.text = title;

}


- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSObject *obj = (NSObject *)self.target;
    [obj performSelector:self.action withObject:self];
}


@end





